package cn.anc.aonicardv.util.ui;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import cn.anc.aonicardv.R;

public class DialogProgressBar extends Dialog {
    private Context mContext;
    private LayoutInflater inflater;
    private View mView;
    private LinearLayout mLinDialog = null;

    public DialogProgressBar(@NonNull Context context) {
        super(context);
        this.mContext = context;
        initView();
    }

    public DialogProgressBar(@NonNull Context context, int themeResId) {
        super(context, themeResId);
        this.mContext = context;
        initView();
    }

    public void setText(String text) {
        TextView tv = (TextView) mView.findViewById(R.id.text_dialog);
        tv.setText(text);
    }

    private void initView() {
        inflater = LayoutInflater.from(mContext);
        mView = inflater.inflate(R.layout.dialog_progressbar, null);
        mLinDialog = (LinearLayout) mView.findViewById(R.id.lin_dialog);
        mLinDialog.getBackground().setAlpha(190);
        setContentView(mView);
        setCancelable(false);
        setCanceledOnTouchOutside(false);
    }

}
